fn main() {
    let str = vec![1, 100, 2, 3, 4];
    println!("{}", get_largest(str));
    let point1: TwoDimensionalPoint<u16> = TwoDimensionalPoint { x: 200, y: 80 };
    println!("{:?}", point1);
}

// ------------------------- 函数泛型 ----------------------------
fn get_largest<T: PartialOrd + Copy>(items: Vec<T>) -> T {
    let mut result: T = items[0];
    for item in items {
        if item > result {
            result = item;
        }
    }
    result
}
// ------------------------- 结构体泛型 --------------------------
#[derive(Debug)]
struct TwoDimensionalPoint<T> {
    x: T,
    y: T
}
